package com.itbaizhan.controller;

import com.itbaizhan.dto.UserAccountDTO;
import com.itbaizhan.service.UserAccountService01;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.math.BigDecimal;
import java.util.UUID;

/**
 * @author spf
 * @date 2024/4/18
 * @time 15:45
 */
@RestController
@RequestMapping("/bank")
public class UserAccountController {

    @Autowired
    private UserAccountService01 userAccountService01;

    @GetMapping("/transfer")
    public String transfer(UserAccountDTO userAccountDTO){
        String txNo = UUID.randomUUID().toString();
        userAccountDTO.setTxNo(txNo);
        userAccountService01.transfer(userAccountDTO);
        return "转账成功！";
    }

    @GetMapping("/test")
    public String test(@RequestParam("id") String id){
//        userAccountService01.transfer(userAccountDTO);
        return "{id}" + id;
    }

}
